import React, { Component } from 'react'
import {connect} from "react-redux"
import {HashRouter as Router,Route,Switch} from "react-router-dom"
import Home from './pages/Home'
import About from './pages/About'
import Goods from './pages/Goods'
import User from "./pages/User"
import AsyncUser from './pages/AsyncUser'



class App extends Component <any,any>{
  render() {
    return (
      <div>
          {this.props.flag?<div>
              <a href='#/home'>Home</a>|<a href="#/about">About</a>|<a href='#/goods'>Goods</a>|<a href='#/user'>User</a>|<a href='#/asyncuser'>AsyncUser</a>
          </div>:""}
          
          <hr></hr>
          <div></div>
          <div>
            <Router>
                <Switch>
                    <Route path="/" exact component={Home}></Route>
                    <Route path="/home" component={Home}></Route>
                    <Route path="/about" component={About}></Route>
                    <Route path="/goods" component={Goods}></Route>
                    <Route path="/user" component={User}></Route>
                    <Route path="/asyncuser" component={AsyncUser}></Route>
                </Switch>
            </Router>
          </div>
      </div>
    )
  }
}
let mapStateToProps=(state:any)=>({
    flag:state.flag.flag
})
let mapDispathToProps={}
export default connect(mapStateToProps,mapDispathToProps)(App)